﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using Model;


namespace BL
{
    public class ApplicationManager
    {
        public List<Model.Applicaty> getAllApplications()
        {
            dbopenleuvenDataContext db = new dbopenleuvenDataContext();
            var result = from a in db.Applicaties select a;
            List<Model.Applicaty> mijnApplicaties = result.ToList();

            return mijnApplicaties;
        }

        public List<Model.Rollen> getApplicationsByUserDeveloper() //hier klopt iets niet in de query, nog herzien
        {
            dbopenleuvenDataContext db = new dbopenleuvenDataContext();
            var result = from a in db.Rollens join d in db.Rollens on a.RolID equals d.RolID where a.RolID == 3 select a;
            List<Model.Rollen> mijnApplicaties = result.ToList();

            return mijnApplicaties;
        }

        public List<Model.Applicaty> getApplicationsByDeveloper(int userid)
        {
            dbopenleuvenDataContext db = new dbopenleuvenDataContext();
          
            var result = from a in db.Applicaties where a.UserID == userid select a;
            List<Model.Applicaty> mijnApplicaties = result.ToList();

            return mijnApplicaties;       
        }
    }
}
